<?php
// 是建立连接
$client = stream_socket_client("tcp://127.0.0.1:9001    ", $errno, $errstr);

if (! $client) {
    echo $errstr . PHP_EOL;
    exit;
}

while (true) {
    // echo "===》 准备发送信息 \n";
    fwrite($client, "hello world");
    // fread($client, 65535);

    echo "===》 信息发送成功 \n";
    var_dump(fread($client, 65535));
    sleep(2);
}